package demo01;

/**
 * @author mubei
 * @date 2021/11/19
 * @description     继承Thread类 重写run()方法  调用start开启线程
 */
// 1. 继承Thread类
public class TestThread1 extends Thread {

    // 2. 重写run()方法
    @Override
    public void run(){
        for (int i = 0; i < 20; i++) {
            System.out.println("看代码");
        }
    }


    public static void main(String[] args) {
        TestThread1 thread1 = new TestThread1();
        //3. 调用  start 开启线程
        thread1.start();
        for (int i = 0; i < 20000; i++) {
            System.out.println("学习多线程");
        }
    }
}